package com.wsz.educms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wsz.educms.pojo.Banner;
import com.wsz.educms.service.BannerService;
import com.wsz.educms.mapper.BannerMapper;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author wangs
* @description 针对表【crm_banner(首页banner表)】的数据库操作Service实现
* @createDate 2022-10-01 20:41:19
*/
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner>
    implements BannerService{

    @Cacheable(key = "'selectIndexList'",value = "banner")
    @Override
    public List<Banner> selectAllBanner() {
        QueryWrapper queryWrapper = new QueryWrapper();

        queryWrapper.orderByDesc("id");
        queryWrapper.last("limit 2");

        List list = baseMapper.selectList(queryWrapper);
        return list;
    }
}




